#include "Arduino.h"
#include "Timer.h"

Timer::Timer(unsigned long Interval, void (*Function)())
{
    active = true;
	previous = 0;
	interval = Interval;
	execute = Function;
}

void Timer::check()
{
  if (active && (millis()-previous >= interval)) 
  {
    previous = millis();
    execute();
  }
}

void Timer::setInterval(unsigned long Interval)
{
	interval = Interval;
}